<?
die("ok");
//更新会员的推荐个数
set_time_limit(1000);

require_once("../config/dbconn.php");require_once("../config/powercls.php");
$sql="select * from (select userid,count(userid) as c from {$db_prefix}yearf where 1 group by userid)c1 where c>1";
echo $sql."<Br>";
$result=$db->query($sql);
if ($db->num_rows($result)==0) die("ok了");
while($rs=$db->fetch_array($result)){
	
	$sqldel="select * from {$db_prefix}yearf where userid='".$rs['userid']."'";
	$rsdel=$db->get_one($sqldel);
	$sqldel="delete from {$db_prefix}yearf where id='".$rsdel['id']."'";
	$db->query($sqldel);
	//删除记录
	$sqldel="select * from {$db_prefix}caiwu where userid='".$rs['userid']."' and type=16 and ptype=3";
	$rsdel=$db->get_one($sqldel);
	$sqldel="delete from {$db_prefix}caiwu where id='".$rsdel['id']."'";
	$db->query($sqldel);
	//更新奖金
	$sqlgx="update {$db_prefix}users set jjprice=jjprice+100 where id='".$rs['userid']."'";
	$db->query($sqlgx);
}
$db->free_result($result);

echo "ok";
exit();
?>